package reflection;

public class Test07 {
    public static void main(String[] args) throws ClassNotFoundException {
        //获取系统类的加载器
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        System.out.println(systemClassLoader);

        //获取系统类加载器的父类加载器-->扩展类加载器
        ClassLoader parent = systemClassLoader.getParent();
        System.out.println(parent);

        //获取扩展类加载器的父类加载器--> 根加载器
        ClassLoader classLoader = Class.forName("reflection.Test07").getClassLoader();
        System.out.println(classLoader);

        //测试当前类是哪个加载器加载的
        ClassLoader classLoader1 = Class.forName("java.lang.Object").getClassLoader();
        System.out.println(classLoader1);

        //如何获得系统加载器可以加载的路径
        System.out.println(System.getProperty("java.class.path"));

        /*
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\charsets.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\deploy.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\access-bridge-64.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\cldrdata.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\dnsns.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\jaccess.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\jfxrt.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\localedata.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\nashorn.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\sunec.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\sunjce_provider.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\sunmscapi.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\sunpkcs11.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\zipfs.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\javaws.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\jce.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\jfr.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\jfxswt.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\jsse.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\management-agent.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\plugin.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\resources.jar;
        D:\Program Files\Java\jdk1.8.0_271\jre\lib\rt.jar;
        D:\Java Files\Test\out\production\Test;
        D:\Program Files\ideaIU-2019.2.3.win\lib\idea_rt.jar

         */
    }
}
